package com.teamwings.util;

import org.jeecg.config.mybatis.TenantContext;

/**
 * 编号
 */
public class CodeContext {
	private static ThreadLocal<String> currentUnit = new ThreadLocal<>();

	public static void setUnit(String unit) {
		currentUnit.set(unit);
	}

	public static String getUnit() {
		return currentUnit.get();
	}

	public static String getUnitPrefix() {
		return getUnit() + ":";
	}

	public static void remove() {
		currentUnit.remove();
	}

	public static String getPrefix() {
		return currentUnit.get() + ":tenant_" + TenantContext.getTenant() + ":";
	}
}
